package main.Concurrent.Iteration;

import java.io.Serializable;

public interface IterationOperation<E, R, A> extends Serializable {
    
    /**
     * @param index
     * @param val
     * @return The result that will be given to aggregate at some point
     */
    public R compute(int index, E val);
    
    /**
     * It should be okay here to modify the previous aggregate seeing as how
     * it will probably be garbaged collected afterwards anyway.
     * @param current
     * @param index
     * @param result
     * @return
     */
    public A aggregate(A current, int index, R result);
}
